﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Mogre;

namespace WastedMechanics
{
    class CharTaskPatrol : CharTask
    {        
        public List<Vector3> Points;
        public bool Loop;

        public CharTaskPatrol(Character chr, List<Vector3> points, bool loop, string lbl = "") :
            base(chr, lbl)
        {           
            Points = points;
            Loop = loop;
        }

        public override void Begin()
        {
            if (Loop)
                Character.PushTask(this);
            
            for (int i = Points.Count - 1; i >=0 ; i--)
                Character.PushTask(new CharTaskMoveTo(Character,Points[i], true));
            IsFinished = true;
        }
    }
}
